Skip to content

dinosql/internal: Add lower and upper functions #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2019
Merged

Conversation

kyleconroy
Copy link
Collaborator

Fixes #214

Adding support for advisory locks in #212 broke code generation for the queries that used functions with parameter references. This change restores some of that functionality. The only difference is the name of the field on the parameter struct.

SELECT * FROM company_users WHERE company_slug = $1 AND email = LOWER($2);

used to generate

type Params struct {
    CompanySlug string
    Email string
}

but will now generate

type Params struct {
    CompanySlug string
    Lower string
}

I know that's not ideal, but I thought it would be better to provide a hot fix.

@landbed
Copy link

landbed commented Jul 19, 2020

ba4c9bf

@kyleconroy this version with postgresql still have this issue, we have to using sqlc.arg like below to fix:

SELECT * FROM company_users WHERE company_slug =sqlc.arg(company_slug) AND email = LOWER(sqlc.arg(email));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regression: "relation "lower" does not exist"
2 participants